package org.shijiagen.manager.service.impl;

import lombok.RequiredArgsConstructor;
import org.shijiagen.clients.ProductClient;
import org.shijiagen.clients.SearchClient;
import org.shijiagen.manager.service.ProductService;
import org.shijiagen.param.ProductSaveParam;
import org.shijiagen.param.ProductSearchParam;
import org.shijiagen.pojo.Product;
import org.shijiagen.utils.R;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class ProductServiceImpl implements ProductService {

    private final SearchClient searchClient;

    private final ProductClient productClient;

    @Override
    public R search(ProductSearchParam param) {
        return searchClient.searchProduct(param);
    }

    @Override
    public R save(ProductSaveParam productSaveParam) {
        return productClient.adminSave(productSaveParam);
    }

    @Override
    public R update(Product product) {
        return productClient.adminUpdate(product);
    }

    @Override
    public R remove(Integer productId) {
        return productClient.adminRemove(productId);
    }
}
